<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    // 对象简写
    // (1)  对象的属性名和属性值对应的变量名相同时,可以进行简写 => 将键名和健值对应的变量名简写成一个   (前提: 属性值存储在变量中)
    // (2)  对象中,函数也可以进行简写  => 省略:function
    var name = "张三";
    var age = 18;
    var height = "177cm";
    var weight = "65kg";


    // ES5 传统写法
    var zhang = {
        name:name,
        age:age,
        height:height,
        weight:weight,
        say:function(){
            console.log(this.name,this.age);
        }
    }
    console.log(zhang);
    zhang.say();

    var zhang = {
        name, // name:name
        age,
        height,
        weight,
        say(){
            console.log(this.name,this.age);
        }
    }
    console.log(zhang);
    zhang.say();




</script>
</html>